#include "systick.h"

__IO uint32_t runtime = 0;

void SysTick_Init(void)
{
	if (SysTick_Config(SystemCoreClock / 1000))
	{
		/* Capture error */
		while (1);
	}
    SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
}

uint32_t System_GetTime(void)
{
	return runtime;
}


void delay_ms(__IO uint16_t msec)
{
	uint32_t target_time = runtime + msec;
	while(runtime <= target_time);
}

/*
void SysTick_Handler(void)
{
	GPIO_ResetBits(GPIOE , GPIO_Pin_14);
	runtime++;
}*/


